CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
PROJECT(Trinity.C)

FILE(GLOB_RECURSE TRINITY_SRC *.cpp)
ADD_LIBRARY(Trinity SHARED ${TRINITY_SRC})
ADD_LIBRARY(Trinity.BCL INTERFACE)

TARGET_INCLUDE_DIRECTORIES(Trinity.BCL INTERFACE include)
TARGET_COMPILE_DEFINITIONS(Trinity.BCL INTERFACE -DUNICODE -D_UNICODE)
TARGET_INCLUDE_DIRECTORIES(Trinity PRIVATE src)
TARGET_COMPILE_DEFINITIONS(Trinity PUBLIC -DUNICODE -D_UNICODE)
TARGET_LINK_LIBRARIES(Trinity PUBLIC Trinity.BCL)

IF(UNIX) 
    TARGET_LINK_LIBRARIES(Trinity PRIVATE crypto;ssl;pthread)
ELSEIF(WIN32)
    ADD_DEFINITIONS(-DWIN32 -DNDEBUG -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -D_USRDLL -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
    TARGET_LINK_LIBRARIES(Trinity PRIVATE Psapi.lib;ws2_32.lib;Dbghelp.lib;Synchronization.lib)
    TARGET_COMPILE_DEFINITIONS(Trinity INTERFACE -DUNICODE -D_UNICODE)
ENDIF()

POSTBUILD_XPLAT_OUTPUT(Trinity ${XPLAT_LIB_DIR})
INSTALL(DIRECTORY include/ DESTINATION include)
